//
//  UIWebView+Ex.swift
//  GhostWorld
//
//  Created by Kam on 2018/8/10.
//  Copyright © 2018 LKGood. All rights reserved.
//

import UIKit

extension UIWebView {
  func injectDefaultStyle() {
    let cssString = "body { padding-top: 20px; padding-bottom: 30px; font-family: HelveticaNeue; color: #ccc; } img {margin-left: auto; margin-right: auto; display: block; border-radius: 10px; width: 100%; } hr { border: solid 0.5px !important; color: #999; height: 0.5px; } table, th, td { border-collapse: collapse; border: solid 1px !important; color: #999; } a { color: #F7DA64; text-decoration: none; }"
    let jsString = "var style = document.createElement('style'); style.innerHTML = '\(cssString)'; document.head.appendChild(style);"
    stringByEvaluatingJavaScript(from: jsString)
  }
}
